﻿#ifndef WEBSOCKETWND_H
#define WEBSOCKETWND_H

#include <QWidget>
#include <QSettings>
#include <QFileDialog>
#include <QTimer>
#include <QThread>
#include <QCloseEvent> 
#include "ui_websocketwnd.h"
#include "async_client.h"
#include <QPixmap>

namespace Ui {
class WebSocketWnd;
}

class WebSocketWnd : public QWidget
{
    Q_OBJECT

public:
    explicit WebSocketWnd(QWidget *parent = nullptr);
    ~WebSocketWnd();
    void closeEvent(QCloseEvent* e);
    AsyncProcess * async_process_;
signals:
    void start_net();
    void sig_send_msg();
    void mySignal();
    void mySignal(QString);
    void outDisplay(QPixmap pixmap);
//    void sig_send_msg(QString  filepath);
private slots:
    void on_pushButton_send_clicked();
    void startSendData();
private:
    Ui::WebSocketWnd *ui;

    QTimer timer_;
    QSettings* settings_;
    QStringList file_list_;
    int file_index_= 0;
    int cycle_times_ = 1;


    QThread* thread_;
};

#endif // WEBSOCKETWND_H
